//
//  MedicalDetailViewController.m
//  MedicineBox
//
//  Created by ZhiPeng.Y on 15/10/10.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MedicalDetailViewController.h"
#import "GMDCircleLoader.h"
@interface MedicalDetailViewController ()<UIWebViewDelegate>

@end

@implementation MedicalDetailViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.navigationController.navigationBarHidden = NO;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationController.navigationItem.title = self.title;
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:86/255.0 green:137/255.0 blue:156/255.0 alpha:1];
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 60, 0, 60, 33)];
    titleLabel.text = self.title;
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont fontWithName:@"Baskerville-SemiBold" size:17];
    self.navigationItem.titleView = titleLabel;
    [titleLabel release];

    
    
    UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    web.delegate = self;
    NSURL *url = [NSURL URLWithString:self.url];
    [web loadRequest:[NSURLRequest requestWithURL:url]];
    [self.view addSubview:web];
    [GMDCircleLoader setOnView:self.view withTitle:@"正在努力加载中..." animated:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [GMDCircleLoader hideFromView:self.view animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
